<?php
// +----------------------------------------------------------------------
// | WoShiMaiJia Projcet 
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://woshimaijia.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: xinqiyang <517577550@qq.com>
// +----------------------------------------------------------------------


/**
 +------------------------------------------------------------------------------
 * TestAction
 +------------------------------------------------------------------------------
 * @category   
 * @package  
 * @subpackage  
 * @author   xinqiyang <517577550@qq.com>
 +------------------------------------------------------------------------------
 */
 
 class TestAction extends Action {
 	function index() {
        header("Content-type: text/html; charset=utf-8");
        /*
        debug_start('1');
      	import('ORG.Net.IpLocation');
      	
        $ip = new IpLocation();
        dump($ip->getLocationid());
        debug_end('1');
 		*/
        //C(MODULE_NAME,'aaa');
        //dump(MODULE_NAME);
        //dump(ACTION_NAME);
        //$this->error('get error');
 		//$this->display();
 		//echo snapshot('http://www.baidu.com','./baidu.png');
 		//$m = D('user');
 		//$uid =123;
        debug_start('a');
        //(int)$uid;//0.000067s
        //$array=array('aa'=>'a1','bb');
        //Session::set('uid',$array);
        //dump(Session::get('uid'));
        //$email="heihe@aa.com";
        //$this->redirect('login/active',array('email'=>$email));
        //intval($uid);0.000077s
        //$this->assign('lala',L('heihei'));
        //dump(rand(11,18));
        //dump(pinyin('北京'));
        
//        $d=D('user');
//        dump($d->getOne());
      //dump(get_city('125.112.109.140'));

       
        
//       $randkey =array_rand($arr,1);
//       
//       $replace = $arr[$randkey];
//       
//       $tagstr = "我们,他们,你,我,他,小子,玩吧";
//       $tagarr = explode(',',$tagstr);//STRTAG为POST过来的字段
//       foreach($tagarr as $value)
//       {
//       		if($istag)
//       		{
//       			//添加TAG
//       			$values = "<a href='__APP__/tags/words/$value' class='wunlink' target='_blank'>$value</a>";
//       		}else {
//       			//替换词语
//       			$values = $replace;
//       		}
//       		//替换数据库
//       		$result = $d->query("Update $table set $filed=Replace($field,'$value','$values')");
//       		if($result)
//       		{
//       			$returnmsg .= $value;
//       		}
//       }
//       $returnmsg .=" 成功";
       
       
       
       //$tagreplace = $arr;
        //echo highlight_file(__FILE__);
        
        //dump(get_city('218.78.196.218'));
        
        //$d = D('region');
        
        //$result = $d->where('regiontype=2')->select();
        //dump($result);exit;
        //$i = 0;
        //foreach ($result as $value)
        //{
        	//$d->setField('ename',pinyin($value['regionname']),'regionid='.$value['regionid']);
        	//$count = $d->field('count(*)')->where('ename="'.$value['ename'].'"')->select();
        	//dump($d->getLastSQL());
        	//$counts=(int)$count[0]['count(*)'];
        	//dump($counts);
        	//exit;
        	//if($counts>1)
        	//{
        		//echo $value['regionid'].'        '.$value['regionname'].'        '.$value['ename']."     <br />";	
        		//$i++;
        	//}
        	//$value['regionname'] ='';
       // }
        
        //echo 'result'.$i;
//        $array = array('id'=>'123','name'=>'老王');
//        echo json_encode($array);
        //dump(md5('1'.time()));
        debug_end('a');
        /*
        echo $_SERVER['HTTP_HOST'].'<br />';
        C('default_group','show');
        echo C('default_group');
        */
        //$d = D('user');
        //dump($d->r());
        //echo $this->getActionName();
 		//$a = 'heihei';
 		//echo $GLOBALS['a']';
 		//dump($a);
 		//dump(L('tests'));
 		$this->display();
 	}
 	
 	public function spit_sql($string)
 	{
 		global $search_arr,$replace_arr;
 		$search_arr = array("/ union /i","/ select /i","/ update /i","/ outfile /i","/ or /i");
 		$replace_arr = array(' union ',' select ',' update ',' outfile ',' or ');
 			return is_array($string)? array_map('strip_sql',$string):preg_replace($search_arr,$replace_arr,$string);
 	}
 	
 	
 	

 }
 
 ?>